#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QTcpSocket>
#include <QHostAddress>
#include <QFile>
#include <QTimer>
QT_BEGIN_NAMESPACE
namespace Ui { class Client; }
QT_END_NAMESPACE

class Client : public QWidget
{
    Q_OBJECT

public:
    Client(QWidget *parent = nullptr);
    ~Client();
    QString getMsg();
    void sendFileData();

private:
    Ui::Client *ui;
    QTcpSocket *tcpSocket;
    QString time;

    QFile *file;
    QString fileName;
    qint64 fileSize;
    qint64 sendSize;
    qint64 recvSize;
    qint64 max = 20 * 1024;
    QTimer timer;

    bool isFile;
    bool underline = false;
    bool bold = false;
    bool italic = false;

private slots:
    void receiveMessages();
    void mStateChanged(QAbstractSocket::SocketState);
    void on_sendButton_clicked();
    void on_connectButton_clicked();
    void on_stopButton_clicked();
    void on_chooseButton_clicked();
    void on_sendfileButton_clicked();
    void on_underlineTbtn_clicked();
    void on_boldBtn_clicked();
    void on_clearTbtn_clicked();
    void on_colorTbtn_clicked();
    void on_italicTbtn_clicked();
    void on_saveTbtn_clicked();
    void on_fontcbx_currentFontChanged();
    void on_sizeCbx_currentTextChanged();
};
#endif // WIDGET_H
